package com.example.word_book.service;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;

import com.example.word_book.R;
import com.example.word_book.bean.Word;
import com.example.word_book.utils.SqlHelp;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

//        int i = new SqlHelp(this).countWord();
//        Word w  = new SqlHelp(this).randomWord();
//        Log.i(w.getWord(), "onCreate: ");
        init();

    }

    private void init() {
        Button all_word, day_shorthand, view_error, dictation, add_word;

        all_word = findViewById(R.id.btn_all_word);
        day_shorthand = findViewById(R.id.btn_day_shorthand);
        view_error = findViewById(R.id.btn_view_error);
        dictation = findViewById(R.id.btn_dictation);
        add_word = findViewById(R.id.btn_add_word);

        ImageView back = findViewById(R.id.img_back);
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(MainActivity.this,LoginActivity.class);
                intent.putExtra("flag","a");
                startActivity(intent);
                finish();
            }
        });

        all_word.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(MainActivity.this,AllWordActivity.class);
                startActivity(intent);
            }
        });
        day_shorthand.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(MainActivity.this,DayShorthandActivity.class);
                startActivity(intent);
            }
        });
        view_error.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(MainActivity.this,ViewErrorActivity.class);
                startActivity(intent);
            }
        });
        dictation.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(MainActivity.this,DictationActivity.class);
                startActivity(intent);
            }
        });
        add_word.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(MainActivity.this,AddWordActivity.class);
                startActivity(intent);
            }
        });
    }
}